package cn.jbit.ams.mainperson.biz.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import cn.jbit.ams.mainperson.biz.MainpersonService;
import cn.jbit.ams.mainperson.dao.MainpersonMapper;
import cn.jbit.ams.user.pojo.Mainperson;


@Service
@Transactional
public class MainpersonServiceImpl implements MainpersonService {
	
	@Autowired
	MainpersonMapper mapper;

	/**
	 * 查询维修人员信息
	 */
	@Override
	public List<Mainperson> optionMainperson() {
		// TODO Auto-generated method stub
		return mapper.optionMainperson();
	}
	
	@Override
	public Page<Mainperson> findMainByPage(Integer pageNum) {
		Page<Mainperson> mainPage=PageHelper.startPage(pageNum,4);
		mapper.findMainInfo();
		return mainPage;
	}



	@Override
	public Page<Mainperson> findMainByName(Integer pageNum, String mName) {
		Page<Mainperson> mainPage=PageHelper.startPage(pageNum,4);
		mapper.findMainByName(mName);
		return mainPage;
	}

	@Override
	public Mainperson fondMainOne(Integer mId) {
		// TODO Auto-generated method stub
		return mapper.fondMainOne(mId);
	}

	@Override
	public void updateMainperson(Mainperson mainperson) {
		try {
			mapper.updateMainperson(mainperson);
		} catch (Exception e) {
			System.out.println("修改失败");
			System.out.println(e);
		}
	}

	@Override
	public void deleteMainperson(Integer mId) {
		try {
			mapper.deleteMainperson(mId);
		} catch (Exception e) {
			System.out.println("删除维修人员失败");
			System.out.println(e);
		}
	}
	
	@Override
	public List<Mainperson> ajax_01(String id) {
		// TODO Auto-generated method stub
		
		return mapper.ajax_01(id);
	}

	@Override
	public List<Mainperson> mainpersonList(Integer productId) {
		// TODO Auto-generated method stub
		return mapper.mainpersonList(productId);
	}

	@Override
	public List<Mainperson> abc(String name) {
		// TODO Auto-generated method stub
		return mapper.abc(name);
	}


}
